<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<!--suppress HtmlRequiredTitleElement -->
<head>
    <th:block th:include="include :: header('表单构建')"/>
    <style>
        .layui-icon.layui-icon-close:hover {
            cursor: pointer;
            color: #f44336;
            font-weight: bold;
        }
    </style>
</head>
<body class="layui-layout-body theme-himio">
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">form表单</li>
                    <li>数据权限代码</li>
                </ul>
                <div class="layui-tab-content">

                    <!--form表单生成-->
                    <div class="layui-tab-item layui-show">

                        <div class="layui-form">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">表单ID</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="formId" required lay-verify="required" placeholder="请输入表单ID" autocomplete="off" class="layui-input"
                                               th:value="${#dates.millisecond(#dates.createNow())}">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">表单filter</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="formFilter" required lay-verify="required" placeholder="请输入表单filter" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">表单元素</label>
                                <div class="layui-input-block">
                                    <div class="layui-btn-container" id="addBtn">
                                        <button class="layui-btn" data-type="text" data-layui-type="form">输入框</button>
                                        <button class="layui-btn" data-type="password" data-layui-type="form">密码框</button>
                                        <button class="layui-btn" data-type="switch" data-layui-type="form">开关</button>
                                        <button class="layui-btn" data-type="radio" data-layui-type="form">单选框</button>
                                        <button class="layui-btn" data-type="select" data-layui-type="form">下拉单选框</button>
                                        <button class="layui-btn" data-type="checkbox" data-layui-type="form">复选框</button>
                                        <button class="layui-btn" data-type="textarea" data-layui-type="form">文本域</button>
                                        <button class="layui-btn" data-type="upload" data-layui-type="upload">上传域</button>
                                        <button class="layui-btn" data-type="xmSelect" data-layui-type="xmSelect">下拉多选框</button>
                                        <button class="layui-btn" data-type="tinymce" data-layui-type="tinymce">富文本</button>
                                        <button class="layui-btn" data-type="submit" data-layui-type="form">提交按钮</button>
                                    </div>
                                    <p class="text-danger">重置表单请点击顶部的刷新按钮</p>
                                </div>
                            </div>
                            <hr>
                            <div class="layui-form-item">
                                <div class="layui-row layui-col-space20">
                                    <div class="layui-col-md7" id="example">
                                        <form class="layui-form" id="example-form" lay-filter="" style="padding: 20px;" onsubmit="return false;"></form>
                                    </div>
                                    <div class="layui-col-md5">
                                        <textarea class="layui-textarea" id="resource" style="min-height: 600px;" readonly></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--form表单生成结束-->

                    <!--数据权限mapper-->
                    <div class="layui-tab-item">
                        <blockquote class="layui-elem-quote">
                            请先<a ew-href="/tool/gen" ew-title="代码生成" class="text-info">导入相关表</a>以供选择，生成结果为 mapper.xml 中的 list/page 查询（可用于列表或者数据集合）<br/>
                            <span class="text-danger">前提条件：生成的目标表字段必须包含基础字段（即create和modified相关字段，也就是继承了BaseEntity实体）</span>
                        </blockquote>
                        <form class="layui-form">
                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-required">需要生成的表</label>
                                <div class="layui-input-inline">
                                    <select name="tableName" lay-filter="tableName" lay-verify="required" lay-search>
                                        <option value="">请选择</option>
                                        <option th:each="table:${tables}" th:value="${table.tableId}" th:text="${table.tableName}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">mapper内容:</label>
                                <div class="layui-input-block">
                                    <label>
                                        <textarea name="mapper" class="layui-textarea" readonly style="min-height: 500px;"></textarea>
                                    </label>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">service内容:</label>
                                <div class="layui-input-block">
                                    <label>
                                        <textarea name="service" class="layui-textarea" readonly style="min-height: 200px;"></textarea>
                                    </label>
                                </div>
                            </div>
                        </form>
                    </div>
                    <!--数据权限mapper 结束-->

                </div>
            </div>
        </div>
    </div>
</div>

<!-- 固定底部按钮 -->
<script type="text/html" id="addFormDialog">
    <form id="addForm" lay-filter="addForm" class="layui-form model-form no-padding">
        <input name="type" type="hidden"/>
        <div class="model-form-body" style="" onscroll="layui.admin.hideFixedEl();">
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">字段名称:</label>
                <div class="layui-input-inline">
                    <label>
                        <input name="fieldCnName" placeholder="字段名称，用于显示" class="layui-input"
                               lay-verify="required" lay-verType="tips" required/>
                    </label>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">表单字段:</label>
                <div class="layui-input-inline">
                    <label>
                        <input name="fieldName" placeholder="提交表单的字段属性" class="layui-input"
                               lay-verify="required" lay-verType="tips" required/>
                    </label>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">是否必填</label>
                <div class="layui-input-block">
                    <input type="radio" name="required" value="1" title="是">
                    <input type="radio" name="required" value="0" title="否" checked>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">表单占位</label>
                <div class="layui-input-block">
                    <input type="radio" name="display" value="layui-input-block" title="块元素（layui-input-block）" checked>
                    <input type="radio" name="display" value="layui-input-inline" title="行内元素（layui-input-inline）">
                </div>
            </div>
            <div class="layui-form-item layui-hide" id="switchTxt">
                <label class="layui-form-label ">开关文本:</label>
                <div class="layui-input-block">
                    <label>
                        <input name="switchTxt" placeholder="请输入开关文本,竖线隔开" class="layui-input"/>
                    </label>
                </div>
            </div>
            <div class="layui-form-item layui-hide" id="radioTxt">
                <label class="layui-form-label ">单选文本:</label>
                <div class="layui-input-block">
                    <label>
                        <textarea name="radioTxt" placeholder="一行表示一个单选，每个单选的label和value用逗号隔开，格式如：是,1" class="layui-textarea"></textarea>
                    </label>
                </div>
            </div>
            <div class="layui-form-item layui-hide" id="checkboxTxt">
                <label class="layui-form-label ">复选文本:</label>
                <div class="layui-input-block">
                    <label>
                        <textarea name="checkboxTxt" placeholder="一行表示一个单选，每个单选的label和value用逗号隔开，格式如：是,1" class="layui-textarea"></textarea>
                    </label>
                </div>
            </div>
            <div class="layui-form-item layui-hide" id="selectTxt">
                <label class="layui-form-label ">下拉文本:</label>
                <div class="layui-input-block">
                    <label>
                        <textarea name="selectTxt" placeholder="一行表示一个下拉，每个单选的label和value用逗号隔开，格式如：是,1" class="layui-textarea"></textarea>
                    </label>
                </div>
            </div>
            <div class="layui-form-item layui-hide" id="xmSelectTxt">
                <label class="layui-form-label ">下拉多选文本:</label>
                <div class="layui-input-block">
                    <label>
                        <textarea name="xmSelectTxt" placeholder="一行表示一个下拉，每个单选的label和value用逗号隔开，格式如：是,1" class="layui-textarea"></textarea>
                    </label>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">样式:</label>
                <div class="layui-input-block">
                    <label>
                        <textarea name="style" placeholder="请输入css内容，style属性里面的内容，如：width:200px;font-size:14px;" class="layui-textarea" maxlength="500"></textarea>
                    </label>
                </div>
            </div>

        </div>
        <div class="layui-form-item text-right model-form-footer">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="dialogEditSubmit1" lay-submit>保存</button>
        </div>
    </form>
</script>
<!-- js部分 -->
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "tool/gen2";
</script>
<th:block th:include="include :: tinymceJs"/>
<script th:src="@{/static/assets/system/js/gen2.js}"></script>
</body>
</html>